<template>
	<view class="zhuce wangji">
		<myNav>
			<view slot="left" @click="back"><uni-icons type="closeempty" color="#fff"></uni-icons></view>
			<view>经纪人注册页面</view>
		</myNav>
		<view class="input-content">
			<view class="input">
				<input type="text" v-model="info.useid" placeholder="请输入姓名" placeholder-class="shrumoren1" />
				<image src="../../static/all/zhuce/p.png" mode=""></image>
			</view>
			<view class="input">
				<input type="text" v-model="info.phoneNumber" value="" placeholder="请输入大陆手机号" placeholder-class="shrumoren1" />
				<image src="/static/all/forget/phone.png" mode=""></image>
			</view>
			<view class="input">
				<input type="password" v-model="info.password1" value="" placeholder="请设置密码" placeholder-class="shrumoren1" />
				<image src="/static/all/zhuce/s.png" mode=""></image>
			</view>
			<view class="input">
				<input type="password" v-model="info.passoword2" value="" placeholder="请再次输入密码" placeholder-class="shrumoren1" />
				<image src="/static/all/zhuce/s.png" mode=""></image>
			</view>
			<view class="input">
				<input type="text" v-model="info.proofOfIdentity" value="" placeholder="请输入有效身份证号码" placeholder-class="shrumoren1" />
				<image src="/static/all/zhuce/c.png" mode=""></image>
			</view>
		</view>
		<view class="bottom">
			<view class="pointer-left back" @click="back">返回上一页</view>
			<view class="pointer back" @click="registration">确认注册</view>
		</view>
	</view>
</template>

<script>
import myNav from '../../components/mynav/mynav.vue';
import { mapMutations } from 'vuex';
import { registration } from '@/api/index.js';
import { MyShow ,Reg} from '@/util/my.js';
console.log(MyShow);
export default {
	components: {
		myNav
	},
	data() {
		return {
			info: {
				useid: '',
				password1: '',
				passoword2: '',
				proofOfIdentity: '',
				phoneNumber:""
			}
		};
	},
	methods: {
		...mapMutations(['back']),
		
		async registration() {
			// 注册
			//验证手机号
			if(!new Reg().checkPhone(this.info.phoneNumber) ){
				console.log(this.info.phoneNumber);
				new MyShow('手机号错误').tixing();
				return
			}
			try {
				let reslut = await verification(this.info);
				//成功
				new MyShow('需要渲染的字段').tixing();
			} catch (e) {
				//TODO handle the exception
				new MyShow('需要渲染的字段').tixing();
			}
			// 成功跳转
			this.back();
		}
	}
};
</script>

<style lang="scss">
@import './main.scss';
.shrumoren1 {
	color: #000;
}
</style>
